#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage) #return #end
	#setLocal(startPage = currentPage - 4)
	#if (startPage < 1) #setLocal(startPage = 1) #end

	#setLocal(endPage = currentPage + 4)
	#if (endPage > totalPage) #setLocal(endPage = totalPage) #end

	<ul class="pagination">
			#if (currentPage <= 8)
				#setLocal(startPage = 1)
			#end
			#if ((totalPage - currentPage) < 8)
				#setLocal(endPage = totalPage)
			#end

			#if (currentPage == 1)
				<!--<span class="disabled prev_page">上页</span>-->
		        <li class="disabled"><a href="#">&laquo;</a></li>
		#else
				<li href="#(link)#(currentPage - 1)#(append)" class="disabled">&laquo;</li>
			#end

			#if (currentPage > 5)
        <li><a href="#(link)#(1)#(append)">#(1)</a><span class="sr-only"></span></a></li>
        <li><a href="#(link)#(2)#(append)">#(2)</a><span class="sr-only"></span></a></li>

        <!--<a href="#(link)#(1)#(append)">#(1)</a>-->
				<!--<a href="#(link)#(2)#(append)">#(2)</a>-->
				<span class="gap">…</span>
			#end

			#for(i : [startPage..endPage])
				#if (currentPage == i)
        <li class="active"><a href="#">#(i) <span class="sr-only">(current)</span></a></li>

        <!--<span class="current">#(i)</span>-->
				#else
        <li class="active"><a href="#(link)#(i)#(append)">#(i) <span class="sr-only">(current)</span></a></li>

        <!--<a href="#(link)#(i)#(append)">#(i)</a>-->
				#end
			#end

			#if ((totalPage - currentPage) >= 5)
        <!--<li><a href="#">2 <span class="sr-only"></span></a></li>-->

        <span class="gap">…</span>
        <li><a href="#(link)#(totalPage - 1)#(append)">#(totalPage - 1)<span class="sr-only"></span></a></li>
        <li><a href="#(link)#(totalPage)#(append)">#(totalPage)<span class="sr-only"></span></a></li>
			#end

			<!--#if (currentPage == totalPage)-->
				<!--<span class="disabled next_page">下页</span>-->
			<!--#else-->
				<!--<a href="#(link)#(currentPage + 1)#(append)" class="next_page" rel="next">下页</a>-->
			<!--#end-->
	</ul>
#end